import { createRouter, createWebHashHistory } from 'vue-router'
// createRouter 创建路由的实例 
// createWebHashHistory 调用该方法 表示路由使用hash（哈希）模式
import Home from '../views/Home.vue'
/**
 * 在vue2中
 * import VueRouter from 'vue-router'
 * import Vue from 'vue'
 * Vue.use(VueRouter)
 * 
 * 
 * */
const routes = [{
        path: '/',
        name: 'Home',
        component: Home
    },
    {
        path: '/about',
        name: 'About',
        // route level code-splitting
        // this generates a separate chunk (about.[hash].js) for this route
        // which is lazy-loaded when the route is visited.
        component: () =>
            import ( /* webpackChunkName: "about" */ '../views/About.vue')
    }
]

const router = createRouter({
    history: createWebHashHistory(),
    routes
})

export default router